#ifndef WORKSPACE_HEADER_VIZMF_PROJECT
#define WORKSPACE_HEADER_VIZMF_PROJECT

#include <string>
#include <vector>
#include "src/core/workspace/molecule/molecule.h"
//#include "src/core/workspace/group.h"
#include "src/core/scene/scene.h"
#include "src/core/workspace/field.h"

/*
  VizMF WorkSpace class

  One WorkSpace groups data corresponding to a distinct frame in MDI stucture of GUI
*/

class WorkSpace {
private:
  typedef std::vector<Molecule> VM;
//  typedef std::vector<Group> VG;
  typedef std::list<Lattice> VL;
  typedef std::list<Field> VF;

public:
  typedef unsigned int int_type;
  typedef std::string string;
    typedef VM::iterator molecule_iterator_type;
    typedef VM::const_iterator molecule_const_iterator_type;

    typedef VL::iterator lattice_iterator_type;
    typedef VL::const_iterator lattice_const_iterator_type;

    typedef VF::iterator field_iterator_type;
    typedef VF::const_iterator field_const_iterator_type;

//    typedef VG::iterator group_iterator_type;
//    typedef VG::const_iterator group_const_iterator_type;

public:
// todo: member functions go here
  WorkSpace(const int_type number = 0, const string& name = string())
    : number_(number), name_(name), modified_(false)
  {
//      groups_[0] = Group(0, "Default group");
  }


  void addMolecule(const Molecule& molecule) { molecules_.push_back(molecule); }
  molecule_iterator_type moleculesBegin() { return molecules_.begin(); }
  molecule_iterator_type moleculesEnd() { return molecules_.end(); }
  molecule_const_iterator_type moleculesBegin() const { return molecules_.begin(); }
  molecule_const_iterator_type moleculesEnd() const { return molecules_.end(); }

  const Lattice* addLattice(const Lattice& lattice)
  {
    lattices_.push_back(lattice);
    return &(*(lattices_.end()--));
  }
  lattice_iterator_type latticesBegin() { return lattices_.begin(); }
  lattice_iterator_type latticesEnd() { return lattices_.end(); }
  lattice_const_iterator_type latticesBegin() const { return lattices_.begin(); }
  lattice_const_iterator_type latticesEnd() const { return lattices_.end(); }

  void addField(const Field& field) { fields_.push_back(field); }
  field_iterator_type fieldsBegin() { return fields_.begin(); }
  field_iterator_type fieldsEnd() { return fields_.end(); }
  field_const_iterator_type fieldsBegin() const { return fields_.begin(); }
  field_const_iterator_type fieldsEnd() const { return fields_.end(); }

//  void addGroup(const Group& group) { groups_.push_back(group); }
//  group_iterator_type groupsBegin() { return groups_.begin(); }
//  group_iterator_type groupsEnd() { return groups_.end(); }
//  group_const_iterator_type groupsBegin() const { return groups_.begin(); }
//  group_const_iterator_type groupsEnd() const { return groups_.end(); }

  bool modified() const { return modified_;}
  void setModified(bool value = true) { modified_ = value; }

  const string& name() const { return name_; }
  void setName(const string& name) { name_ = name; }

  int_type id() { return number_; }

  void setWidget(ItemWidget* widget) { scene_.setWidget(widget); }
  ItemWidget* scene() { return (ItemWidget*) &scene_; }

private:
  int_type number_;
  string name_;
//	MoleculeSelection molsel_;
  Scene scene_;	// both SceneElements and SceneParameters are here
  VM molecules_;	// raw molecules whose parts form a group via selection --> molecules should be accessible via Group
//  VG groups_;
  VL lattices_;
  VF fields_;
  bool modified_;
};


#endif // WORKSPACE_HEADER_VIZMF_PROJECT
